using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter06
{
	/// <summary>
	/// Example10: Sphere Falling in Oil
	/// A small sphere of mass 2.00kg is released from rest in 
	/// a large vessel filled with oil, where it experiences a 
	/// resistive force proportional to its speed. The sphere 
	/// reaches a terminal speed of 5.00 cm/s. Determine the time 
	/// constant and the time at which the sphere reaches 90.0% of 
	/// its terminal speed.
	/// \tau = 5.1\times 10^{-3} sec
	/// t = 11.7\times 10^{-3} sec
	/// </summary>
	public class Example10
	{
		public Example10()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			// d^2y/(dt)^2 = - g - b/m dy/dt
			// terminal velocity = v_t = -mg/b
			// dy/dt = -mg/b(1-exp(-t/tau))
			// tau = b/m = v_t / g
			double v_t = 0.05;
	//		double m = 2.0;
			double g = L.Constant.AccelerationOfGravity;
			double tau = v_t/g;
			double time = -tau*Math.Log(0.1);
			result += Convert.ToString(tau)+"   "+
				Convert.ToString(time);
		}
	}
}
